<template>
  <div class="header warp">
    <div class="header-left">
      <img src="@/assets/img/indexLogo.6f8ac4f0.png" alt="" />
    </div>
    <ul class="header-center">
      <li
        @click="$router.push('/home')"
        :class="{ active: $route.path == '/home' }"
      >
        首页
      </li>
      <span
        @click="$router.push('/goods')"
        :class="{ item: $route.path == '/goods' }"
        >全部商品</span
      >
      <li
        @click="$router.push('/user')"
        :class="{ active: $route.path == '/user' }"
      >
        个人中心
      </li>
      <li
        @click="$router.push('/order')"
        :class="{ active: $route.path == '/order' }"
      >
        我的订单
      </li>
      <li
        @click="$router.push('/free')"
        :class="{ active: $route.path == '/free' }"
      >
        专属福利
      </li>
    </ul>
    <div class="header-right">
      <input type="text" placeholder="输入关键字" v-model="searchVal" />
      <span @click="searchFn">
        <img src="@/assets/img/search.png" alt="" />
      </span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchVal: "",
    };
  },
  methods: {
    searchFn() {
      this.$router.push(`/goods?keyword=${this.searchVal}`);
    },
  },
};
</script>

<style lang="less" scpoed>
.header {
  height: 118px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .header-center {
    display: flex;
    justify-content: space-between;
    width: 500px;
    li {
      font-weight: 500;
      cursor: pointer;
      &.active {
        color: #0a328e;
      }
    }
  }
  .header-right {
    display: flex;
    input {
      width: 214px;
      height: 40px;
      border: 1px solid #dedede;
      border-radius: 20px 0px 0px 20px;
      box-sizing: border-box;
      text-indent: 2em;
      //轮廓框
      outline-style: none;
    }
    span {
      width: 50px;
      height: 40px;
      background: #0a328e;
      border-radius: 0px 20px 20px 0px;
      text-align: center;
      line-height: 40px;
    }
  }
}
</style>